function register() {
    api.addEventListener({
        name: 'advertActive'
    }, function (ret, err) {
        console.log(JSON.stringify(ret));
        var jid = ret.value.jid;
        //type('circle'://圈子,'learnplan'：//学习)
        if (ret.value.type === 'learnplan') {
            jumpStudy(jid, ret.value.type);
        } else if (ret.value.type === 'circle') {
            api.sendEvent({
                name: 'changeJxjidNotifi',
                extra: {
                    isJump: true,
                    jumpTo: 'circle'
                }
            });
        }
    });
    api.addEventListener({
        name: 'audio_fail'
    }, function (ret, err) {
        console.log("添加至队列");
        failMessage.push(ret.value);
    });
}

//确定
function cleanConfirm() {
    //      $('#offlineAlert').hide();
    // $api.setStorage('cfnetppLoginStatus', 0);
    // $api.setStorage('cfnetppusericon', "");
    // $api.setStorage('cfnetUserName', "");
    // $api.setStorage('cfnetppjxidname', "");
    // $api.setStorage('stdydata', "");
    // //清空学习集团
    // $api.setStorage('practicedata', "");
    // //清空实习集团
    // $api.setStorage('cfnetpppassword', "");
    // $api.setStorage('cfnetppuid', "");
    // $api.setStorage('cfnetppjxid', "");
    // $api.setStorage('cfnetSelectType', "");
    // $api.setStorage('cfnetppusername', "");


    // api.openWin({useWKWebView:true,
    //     name: 'login',
    //     url: 'login.html',
    //     slidBackEnabled: false,
    //     animation: {
    //         type: "none", //动画类型（详见动画类型常量）
    //         subType: "from_right", //动画子类型（详见动画子类型常量）
    //         duration: 100
    //     },
    // });
    // api.closeWin();

}

function jumpStudy(currentJid, type) {
    var params = {
        uid: $api.getStorage('cfnetppuid')
    };
    cfnetppPOST(url_getJiTuanList, params, false, function (data, status) {
        if (status == 'success') {
            if (data.code == 200 || data.code == 190) {
                var stdydata = data.data.jiaoxue;
                if (stdydata != undefined) {
                    for (var i = 0; i < stdydata.length; i++) {
                        if (stdydata[i].id == currentJid) {
                            $api.setStorage('cfnetppjxid', currentJid);
                            $api.setStorage('tempjid', currentJid);//存储临时jid用于解决实习学习集团id问题
                            $api.setStorage('cfnetppjxidname', stdydata[i].name);
                            api.sendEvent({
                                name: 'changeJxjidNotifi',
                                extra: {
                                    currentJxjid: currentJid,
                                    isJump: true,
                                    jumpTo: type
                                }
                            });
                            return;
                        }
                    }
                }
                api.alert({
                    title: "提示",
                    msg: '您还未加入该集团...',
                }, function (ret, err) {

                });
            }
        }
    });
}